<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- <b><i>加粗文本</i></b>
    <div id="box">文本节点测试</div> -->
    <!-- <div>1</div>
    <div>2</div>
    <div>3</div>
    <div>4</div>
    <div>5</div> -->
</body>
<script>
    // var divText = document.getElementById("box");
    // console.log(divText);
    // divText.innerHTML = "<b><i><u>div文本节点测试</u></i></b>";
    //1.
    // var divs = document.getElementsByTagName("div");
    // console.log(divs);
    // for (let index = 0; index < divs.length; index++) {
    //     const element = array(divs[index]);
    // }
    var newDiv = document.createElement("div");
    newDiv.innerHTML = "<h1>新标题</h1>";
    document.body.appendChild(newDiv);
    var p1 = document.createElement("p");
    p1.innerHTML = "p标签内容";
    document.body.insertBefore(p1,document.body.firstChild);
    // document.body.insertBefore(p1,document.body.lastChild);

    </script>
</html>